package com.suifeng.mq.stock.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.suifeng.mq.stock.entity.StockEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface StockDao extends BaseMapper<StockEntity> {


    /**
     * 查询这个商品在哪里有库存
     * @param goodsId
     * @return
     */
    List<Long> listStockIdHasGoodsStock(@Param("goodsId") Long goodsId);


    Long lockGoodsStock(@Param("goodsId") Long goodsId, @Param("stockId") Long stockId, @Param("num") Integer num);

    void unLockStock(@Param("goodsId") Long goodsId, @Param("stockId") Long stockId, @Param("num") Integer num);

}
